import json, os

class Introduction(dict):
    def __init__(self, file='../knowledge/introduce.json') -> None:
        with open(os.path.join(os.path.dirname(__file__), file), 'r', encoding='utf-8') as f:
            intro = json.load(f)
        super(Introduction, self).__init__(intro)
        self.file = file

class PeopleInform(dict):
    def __init__(self, file='../knowledge/people.json') -> None:
        with open(os.path.join(os.path.dirname(__file__), file), 'r', encoding='utf-8') as f:
            intro = json.load(f)
        super(PeopleInform, self).__init__(intro)
        self.file = file

    def update(self):
        with open(os.path.join(os.path.dirname(__file__), self.file), 'w', encoding='utf-8') as f:
            json.dump(self, f)

class RoomInform(dict):
    def __init__(self, file='../knowledge/room.json') -> None:
        with open(os.path.join(os.path.dirname(__file__), file), 'r', encoding='utf-8') as f:
            intro = json.load(f)
        super(RoomInform, self).__init__(intro)
        self.file = file

if __name__ == '__main__':
    v = PeopleInform()
    v['Alice']['state'] = 'off work'
    v.update()
    pass
